package com.jindu.producer.system.jpa;

import com.jindu.producer.system.model.SMobileVerificationEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author jarvis
 */
@Transactional
public interface MobileVerificationJpa extends JpaRepository<SMobileVerificationEntity,Long>,JpaSpecificationExecutor {


    SMobileVerificationEntity findById(String id);

    /**
     * 根据验证码查询，是否有符合的访问码，用于官网的授权访问
     * @param verification
     * @return
     */
    @Query("select s from SMobileVerificationEntity s where s.status=1 and s.verification = ?1")
    SMobileVerificationEntity findByVerification(int verification);


}
